if(BUILD_RDKIT_BENCHMARK)
  include_directories("${RDKIT_INCLUDE_DIR}")
  include_directories("${RDKIT_INCLUDE_DIR}/rdkit")
  find_package(Boost 1.45.0 COMPONENTS program_options REQUIRED)
  function(build_rdkittest RDKITBENCHMARK_EXECUTABLE LIBRARY) 
    add_executable("${RDKITBENCHMARK_EXECUTABLE}" rdkitmain.cpp)
    if("${RDKIT_LIB_DIR}" STREQUAL "")
      find_library(RDKIT_GRAPHMOL NAMES GraphMol)
      find_library(RDKIT_FILEPARSERS NAMES FileParsers)
      find_library(RDKIT_RDGENERAL NAMES RDGeneral)
    else()
      find_library(RDKIT_GRAPHMOL NAMES GraphMol PATHS "${RDKIT_LIB_DIR}" NO_DEFAULT_PATH)
      find_library(RDKIT_FILEPARSERS NAMES FileParsers PATHS "${RDKIT_LIB_DIR}" NO_DEFAULT_PATH)
      find_library(RDKIT_RDGENERAL NAMES RDGeneral PATHS "${RDKIT_LIB_DIR}" NO_DEFAULT_PATH)
    endif()
    set (EXTRA_LIBS "${RDKIT_GRAPHMOL}" "${RDKIT_FILEPARSERS}"
    	 "${RDKIT_RDGENERAL}" "${Boost_LIBRARIES}" "${LIBRARY}")
    set_property(TARGET "${RDKITBENCHMARK_EXECUTABLE}" PROPERTY CXX_STANDARD 11)
    target_link_libraries ("${RDKITBENCHMARK_EXECUTABLE}" ${EXTRA_LIBS})
    install(TARGETS "${RDKITBENCHMARK_EXECUTABLE}" RUNTIME DESTINATION bin)
  endfunction()

  build_rdkittest("RDKitBenchmark" "${SHARED_LIBRARY}")
  build_rdkittest("RDKitBenchmark_static" "${STATIC_LIBRARY}")
endif()
